﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace BeachRunner.BeachRunner
{
    /// <summary>
    /// Ermittelt die durch den Spieler erreichten Punkte
    /// 
    /// Autor: Arne Blumentritt
    /// </summary>
    public class ScoreManager
    {
        /// <summary>
        /// die erreichten Punkte im Spiel
        /// </summary>
        private double scores;

        /// <summary>
        /// gibt an wie viele Punkte der Spieler pro Sekunde erhält.
        /// </summary>
        private double scorePerTick;

        public int Scores
        {
            get { return (int)scores; }
            set { this.scores = value; }
        }

        private int velocity;
        public int Velocity
        {
            set { velocity = value; }
        }

        private Vector2 hudPosition;

        /// <summary>
        /// erstellt einen neuen Score
        /// </summary>
        /// <param name="multiplicator">wie schnell die Scores anwachsen</param>
        public ScoreManager()
        {
            scorePerTick = 1.0 / 1000 *Game1.TIME_PER_TICK;
            hudPosition = new Vector2(7, -11);
        }

        public void LoadContent( ContentManager contentManager )
        {
        }
        

        /// <summary>
        /// lässt die Scores anwachsen
        /// </summary>
        public void Update()
        {
            scores += scorePerTick * velocity;
        }

        /// <summary>
        /// stellt die Punkte auf dem Bildschirm da
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="spriteFont"></param>
        /// <param name="vector2"></param>
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(Game1.Font_m, "SCORE " + Scores.ToString(), hudPosition, Color.White);
        }
    }
}
